<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pretty="http://ocpsoft.com/prettyfaces"
	xmlns:security="http://www.springframework.org/security/facelets/tags"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition>
	<security:isAuthenticated>
		<h:panelGroup id="activeOrders"
			rendered="#{! empty companyDetailsBean.activeOrders}">
			<div class="box">
				<h2>
					<a id="toggle-active-orders" href="#"><h:outputText
							value="#{msg['activeorders.active']}" /></a>
				</h2>
				<div id="active-orders" class="block tables">
					<h:form prependid="false">
						<p:dataTable id="activeOrdersTable" var="order"
							value="#{companyDetailsBean.activeOrders}"
							emptyMessage="#{msg['prime.noRecordsFound']}">
							<p:columnGroup type="header">
								<p:row>
									<p:column rowspan="2"
										headerText="#{msg['activeorders.company']}" />
									<p:column rowspan="2" headerText="#{msg['activeorders.order']}" />
									<p:column rowspan="2"
										headerText="#{msg['activeorders.amount']}" />
									<p:column rowspan="2"
										headerText="#{msg['activeorders.priceLimit']}" />
									<p:column rowspan="2" headerText="#{msg['activeorders.type']}" />
									<p:column colspan="2"
										headerText="#{msg['activeorders.expire']}" />
									<p:column rowspan="2"
										headerText="#{msg['activeorders.cancel']}" />
								</p:row>

								<p:row>
									<p:column headerText="#{msg['activeorders.expiryDate']}" />
									<p:column headerText="#{msg['activeorders.orderDate']}" />
								</p:row>
							</p:columnGroup>

							<p:column>
								<pretty:link mappingId="companyDetails">
									<f:param value="#{order.company.name}" />
									<h:outputText value="#{order.company.name}" />
								</pretty:link>
							</p:column>

							<p:column>
								<h:outputText style="font-weight: bold; color: #669900;"
									value="#{order.formattedTransactionType}" />
							</p:column>

							<p:column>
								<h:outputText value="#{order.amount}" />
							</p:column>

							<p:column>
								<h:outputText style="font-weight: bold; color: #FF0000;"
									value="#{order.formattedPriceLimit}" />
							</p:column>

							<p:column>
								<h:outputText value="#{order.formattedPriceType}" />
							</p:column>

							<p:column>
								<h:outputText style="font-weight: bold;"
									value="#{order.formattedExpiryDate}" />
							</p:column>

							<p:column>
								<h:outputText value="#{order.formattedSubmissionDate}" />
							</p:column>

							<p:column>
								<p:commandButton id="cancelButton" ajax="false"
									actionListener="#{companyDetailsBean.cancelOrder(order)}"
									image="ui-icon-close" />
							</p:column>

						</p:dataTable>
					</h:form>
				</div>
			</div>
		</h:panelGroup>
	</security:isAuthenticated>
</ui:composition>

</html>
